///*
// * To change this template, choose Tools | Templates
// * and open the template in the editor.
// */
//package neuralmusic.brain;
//
//import java.util.Observable;
//import java.util.Observer;
//
//import uk.co.drpj.util.tweaks.Tweakable;
//
///**
// *
// * @author pjl
// */
//public class NotePlayingMotor implements Location {
//
//    long stamp;
//    final Point pt;
//
//     public void updateState() {
//        double now = ref.getCurrentTime();
//        state = state * Math.exp(-timeConstant * (now - lastUpdateTime));   
//        lastUpdateTime = now;
//    }
//
//    public ConnectionSink trig = new ConnectionSink() {
//
//        @Override
//        public void excite(Connection aThis, float f) {
//            stamp = ref.getCurrentTime();
//         //   act.fire(f);
//        }
//    };
//
//
////    ConnectionSink ampZ = new ConnectionSink() {
////
////        @Override
////        public void excite(Connection aThis, float f) {
////            updateState();
////            state += f;
////   
////        }
////    };
//////
////
////    ConnectionSink term = new ConnectionSink() {
////
////        @Override
////        public void excite(Connection aThis, float f) {
////      //     System.out.println("TERM: excite");
////
////          if (act != null)  act.setOff();
////
////        }
////    };
//    private final NoteAction act;
//    private final TimeRef ref;
//    double state;
//    private double timeConstant;
//    private double lastUpdateTime;
// 
////    public void updateState() {Location
////        double now = ref.getCurrentTime();
////        state = state * Math.exp(-timeConstant * (now - lastUpdateTime));
////        lastUpdateTime = now;
////    }
//
//    public NotePlayingMotor(NoteAction act, TimeRef ref, Tweakable timeConstantTweak, Point pt) {
//        this.pt = pt;
//        this.act = act;
//        this.ref = ref;
//    
//        timeConstantTweak.addObserver(new Observer() {
//            @Override
//            public void update(Observable o, Object arg) {
//                timeConstant = (float) TimeRef.delayToTimeConstant(((Tweakable)o).doubleValue());
//            }
//        });
//    }
//
//    @Override
//    public Point getPoint() {
//        return pt;
//    }
//
//    @Override
//    public float getDisplayValue() {
//        if (act == null) {
//            return 0;
//
//        }
//        return act.getMidiValue() / 127.0f;
//    }
//}
